package com.ananjt.system.user.controller;


import com.ananjt.system.entity.SpMenu;
import com.ananjt.system.entity.SpUser;
import com.ananjt.system.user.service.SpMenuService;
import com.ananjt.system.vo.UserRoleVo;
import com.ananjt.utils.context.CurrentUser;
import com.sp.system.user.core.utils.ContentResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author chenanhai
 * @since 2020-03-17
 */
@RestController
@RequestMapping("/spMenu")
public class SpMenuController {


    private SpMenuService menuService;

    /**
     * 获取菜单信息
     *
     * @param
     * @return
     */
    @PostMapping("/queryMenuList")
    public Object queryMenuList(SpUser spUser) {
        spUser.setId(CurrentUser.getUserId());
        List<SpMenu> menuList = menuService.queryMenuByUserId(spUser);
        return ContentResult.successResult(menuList, "获取菜单列表");
    }


    @Autowired
    public void setMenuService(SpMenuService menuService) {
        this.menuService = menuService;
    }
}

